package com.im.server;

import com.im.server.server.NioNettyServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@EnableAsync
@Slf4j
public class ImServerApplication implements CommandLineRunner {
    public static void main( String args[] ){
        /*
         * 指定使用的日志框架，否则将会告警
         * RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.InternalThreadLocalMap).
         * RocketMQLog:WARN Please initialize the logger system properly.
         */
        System.setProperty("rocketmq.client.logUseSlf4j", "true");

        ConfigurableApplicationContext context = SpringApplication.run( ImServerApplication.class, args );
        context.getBean(NioNettyServer.class).start();
    }

    @Override
    public void run(String... args) {
        log.info("========================server start success========================");
    }

}
